package com.sskj.mine.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.mine.bean.FbShop;
import com.sskj.mine.http.HttpConfig;
import com.sskj.mine.ui.activity.ApplyShopActivity;

import java.util.List;


public class ApplyShopActivityPresenter extends BasePresenter<ApplyShopActivity> {
    public void apply() {
        httpService.applyShop("2")
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        HttpData httpData = response.body();
                        ToastUtil.showShort(httpData.getMsg());
                        if (httpData.getStatus() == HttpConfig.OK) {
                            mView.applySuccess();

                        }
                    }
                });
    }

    public void fbShopNumber() {
        httpService.moneyUsed("fb_shop", "3")
                .execute(new JsonCallBack<HttpData<List<FbShop>>>(this, false) {
                    @Override
                    public void onSuccess(Response<HttpData<List<FbShop>>> response) {
                        HttpData<List<FbShop>> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.OK) {
                            mView.updateUser(httpData.getData().get(0));
                        }

                    }

                });
    }

}
